﻿// -
// <copyright file="ServiceResponse.cs" company="Microsoft Corporation">
//    Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
// -

namespace Hawaii.Services.Client
{
    using System;
    using System.Threading;
    using System.Net;

    internal class ServiceResponse
    {
        /// <summary>
        /// The outstanding request.
        /// </summary>
        private HttpWebRequest request;

        /// <summary>
        /// The response to the request.
        /// </summary>
        private HttpWebResponse response;

        /// <summary>
        /// The event to wait on while BeginGetResponse is outstanding.
        /// </summary>
        private ManualResetEvent waiter;

        /// <summary>
        /// Initializes a new instance of the FakeGetResponseState class.
        /// </summary>
        /// <param name="request">The request to remember.</param>
        public ServiceResponse(HttpWebRequest request)
        {
            this.request = request;
            this.waiter = new ManualResetEvent(false);
        }

        /// <summary>
        /// Gets the outstanding request.
        /// </summary>
        public HttpWebRequest Request
        {
            get { return this.request; }
        }

        /// <summary>
        /// Gets or sets the response to the request.
        /// </summary>
        public HttpWebResponse Response
        {
            get { return this.response; }
            set { this.response = value; }
        }

        /// <summary>
        /// Gets the event to wait on while BeginGetResponse is outstanding.
        /// </summary>
        public ManualResetEvent Waiter
        {
            get { return this.waiter; }
        }
    }

}
